package Medicine;

public class Goods {
    private int id;//对药品进行编号
    private String name;//药品的名称
    private String type; //药品的类型 有:中药 西药
    private int price; //药品的价格
    private int amount;//剩余数量

    private Boolean isEmpty;//

    public Goods(int id, String name, String type, int price, int amount) {
        this.id = id;
        this.name = name;
        this.type = type;
        this.price = price;
        this.amount = amount;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }
    public boolean isEmpty() {
        return isEmpty;
    }

    public void setEmpty(boolean empty) {
        isEmpty = empty;
    }



    public void reduceAmount() {
        if (amount > 0) {
            amount--; // 减少库存数量
        }
    }

    @Override
    public String toString() {
        return "Medicine{" +
                "编号" + id +
                ", 名称为'" + name + '\'' +
                ", 是'" + type + '\'' +
                ", 价格为" + price +
                "元, 目前剩余数量: " + amount +
                '}';
    }
}
